package com.zs.diveinspringbootkotlin.bootstrap

import org.springframework.boot.WebApplicationType
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.builder.SpringApplicationBuilder

/**
 *
 * @description
 * @author madison
 * @date 2021/6/4 18:24
 *
 */

@EnableAutoConfiguration
class EnableAutoConfigurationBootstrap

fun main(array: Array<String>) {
    val context = SpringApplicationBuilder(EnableAutoConfigurationBootstrap::class.java)
        .web(WebApplicationType.NONE)
        .run(*array)

    // 通过名称和类型获取helloWorld
    val helloWorld = context.getBean("helloWorld")
    println("helloWorld Bean:$helloWorld")

    // 关闭上下文
    context.close()
}